package com.qf.service.impl;

import com.qf.dao.CDListRespository;
import com.qf.pojo.CDList;
import com.qf.service.CDListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CDListServiceImpl implements CDListService {
    @Autowired(required = false)
    CDListRespository cdListRespository;

    @Override
    public List<CDList> findAll() {
        return cdListRespository.findAll();
    }

    @Override
    public CDList findById(Integer id) {
        return cdListRespository.findById(id).get();
    }

    @Override
    public CDList addAndUpdate(CDList cdList) {
        return cdListRespository.saveAndFlush(cdList);
    }

    @Override
    public void delete(Integer id) {
        cdListRespository.deleteById(id);
    }
}
